﻿@using cloudscribe.Web.Pagination
@using conan.Saas
@using conan.Saas.Controllers
@using dotNET.Domain.Entities
@using  dotNET.Dto
@using conan.Saas.Model
@model BaseListViewModel<LoginLogDtoext>
@{
    Layout = "_Layoutlist";
    LoginLogOption filer = ViewBag.filter as LoginLogOption;

}

@section headers{

}

<!-- Main content -->
<section class="content">

    <div class="row">
        <!-- BEGIN SAMPLE TABLE PORTLET-->
        <div class="col-md-12">
            <!-- BEGIN SAMPLE TABLE PORTLET-->
            <div class="box-body" style="padding-bottom:0px;">
                <!--<div class="panel panel-default">-->

                <div class="search row">
                    <div class="col-sm-12 form-group">
                        <div class="form-inline">
                            <form action="/LoginLog/index" method="get" id="searchform">

                              
                                <div class="form-group ">
                                    <label class="control-label  label-lg label-md">用户名:</label>
                                 
                                    <select id="LoginId" name="LoginId" class="form-control input-small input-sm">
                                        <option value="0">=请输入用户账号=</option>
                                    </select>
                                 

                                    
                               
                                </div>

                                
                              

                                
                                <div class="form-group ">

                                    <label class="control-label label-lg label-md">日期:</label>



                                    <input name="kCreatorTime" value="@(filer.kCreatorTime.HasValue?filer.kCreatorTime.Value.ToString("yyyy-MM-dd"):"")" id="kCreatorTime" class="form-control input-small input-sm" type="text" placeholder="起始时间" />
                                    -  <input name="eCreatorTime" value="@(filer.eCreatorTime.HasValue?filer.eCreatorTime.Value.ToString("yyyy-MM-dd"):"")" id="eCreatorTime" class="form-control input-small input-sm" type="text" placeholder="结束时间" />

                                </div>


                                <span class="form-group btn-group">
                                    <button class="btn btn-sm btn-info" type="submit"><i class="fa fa-search"></i> 搜索</button>
                                </span>
                            </form>
                        </div>
                    </div>
                </div>
             



                <div class="table-scrollable">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr class="heading">
                                <th>Id</th>
                                <th>用户名</th>
                                <th>用户类型</th>
                            
                                <th>IP</th>

                                <th>时间</th>


                                  </tr>
                        </thead>
                        <tbody id="tbody">

                            @if (Model.list.Count > 0)
                            {
                                @foreach (var s in Model.list)
                                {
                                    <tr>
                                        <td>@s.Id</td>
                                        <td>@s.Loginname</td>
                                        <td>@s.LoginType</td>
                                      
                                        <td>@s.IP</td>
                                        <td>@s.CreatorTime</td>
                                     
                                    </tr>
                                }
                            }
                        </tbody>
                    </table>
                </div>

                @if (Model.list.Count > 0)
                {
                    <div class="fixed-table-pagination" style="display: block;">
                        <div class="col-sm-4 hidden-xs" style="padding-top:4px;">

                            <span class="pagination-info"> 显示 第 @( (Model.Paging.ItemsPerPage * (Model.Paging.CurrentPage - 1)) + 1) 到 @( (Model.Paging.ItemsPerPage * Model.Paging.CurrentPage) > Model.Paging.TotalItems ? Model.Paging.TotalItems : (Model.Paging.ItemsPerPage * Model.Paging.CurrentPage) ) 条， 共 @Model.Paging.TotalItems 条</span>
                        </div>
                        <div class="col-sm-8 dataTables_paginate;" style="  padding-right:15px; margin-right:0px;">

                       
                            <cs-pager cs-paging-pagesize="@Model.Paging.ItemsPerPage"
                                      cs-paging-pagenumber="@Model.Paging.CurrentPage"
                                      cs-paging-totalitems="@Model.Paging.TotalItems"
                                      cs-pagenumber-param="page"
                                      asp-controller="LoginLog"
                                      asp-action="index"
                                      asp-route-LoginId="@filer.LoginId"
                                       asp-route-eCreatorTime="@filer.eCreatorTime"
                                         asp-route-kCreatorTime="@filer.kCreatorTime"


                                      asp-route-pagesize="@Model.Paging.ItemsPerPage"></cs-pager>
                        </div>
                    
                    </div>
                }

            </div>
            <!-- END SAMPLE TABLE PORTLET-->

        </div>


    </div>

</section>



@section scripts{


<script>
      
   
      


        $(function () {
            $("#LoginId").select2({
                ajax: {
                    url: "/LoginLog/select2data",
                    dataType: 'json',
                    delay: 250,
                    data: function (params) {
                        return {
                            q: params.term,
                        };
                    },
                    processResults: function (data) {
                        return {
                            results: data
                        };
                    },
                    cache: true
                },
                escapeMarkup: function (markup) { return markup; },
                minimumInputLength: 0,
                templateResult: formatRepo,
                templateSelection: formatRepoSelection
            });


         
            //var ddd = $("#LoginId").select2();//获取selectid
            //ddd.val("admin").trigger("change");
        });





        function formatRepo(repo) { return repo.text };
        function formatRepoSelection(repo) { return repo.text };

</script>


  


    <script>

   





      

    </script>

    <script>
        $(function () {
            if (!jQuery().datetimepicker) {
                return;
            }
            $("#kCreatorTime").datetimepicker({
                language: 'zh-CN',
                autoclose: true,
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
                pickerPosition: ("bottom-left")
            });

            $("#eCreatorTime").datetimepicker({
                language: 'zh-CN',
                autoclose: true,
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
                pickerPosition: ("bottom-left")
            });
        });
    </script>

}

